﻿package com.utils 
{
	import com.element.role.Man;
	import com.staticInfo.MapData;
	import flash.display.Sprite;
	
	/**
	 * ...
	 * @author zhengzihua
	 */
	public class DrawLine
	{
		private static var pathLine:Sprite = new Sprite();
		public function DrawLine() 
		{
		}
		public static function drawLine(arr:Array, role:Man):Sprite {
			pathLine.x = MapData.mapInitX;
			pathLine.y = MapData.mapInitY;
			pathLine.graphics.clear();
			pathLine.graphics.lineStyle(1);
			pathLine.graphics.moveTo((role.manPoint.x+role.manPoint.y+1)*MapData.basePix, (role.manPoint.x-role.manPoint.y+1)* MapData.basePix * 0.5);
			while (arr.length!=0) {
				var obj:Object = { };
				obj = arr.shift();
				pathLine.graphics.lineTo(obj.cx+ MapData.basePix, obj.cy+ MapData.basePix*0.5);
			}
			return pathLine;
		}
	}
	
}